<script setup lang="ts">
import { useMemberStore } from '@/stores'

const memberStore = useMemberStore()
// 退出登录
const onLogout = () => {
  // 模态弹窗
  uni.showModal({
    content: '是否退出登录？',
    success: (res) => {
      if (res.confirm) {
        // 清理用户信息
        memberStore.clearUserInfo()
        memberStore.clearProfile()
        // 返回上一页
        uni.navigateBack()
      }
    },
  })
}
</script>

<template>
  <view class="viewport">
    <!-- 列表1 -->
    <view class="list">
      <!-- <view class="list" v-if="memberStore.userInfo"> -->
      <navigator url="/pagesMember/address/address" hover-class="none" class="item">
        <text>我的收货地址</text><text class="iconfont icon-jinru"></text>
      </navigator>
    </view>
    <!-- 列表2 -->
    <view class="list">
      <button hover-class="none" class="item" open-type="openSetting">
        <text>授权管理</text>
        <text class="iconfont icon-jinru"></text>
      </button>
      <button hover-class="none" class="item" open-type="feedback">
        <text>问题反馈</text>
        <text class="iconfont icon-jinru"></text>
      </button>
      <button hover-class="none" class="item" open-type="contact">
        <text>联系我们</text>
        <text class="iconfont icon-jinru"></text>
      </button>
    </view>
    <!-- 列表3 -->
    <view class="list">
      <navigator hover-class="none" class="item" url=" "
        ><text>关于周姨蛋糕</text><text class="iconfont icon-jinru"></text
      ></navigator>
    </view>
    <!-- 操作按钮 -->
    <view class="action" v-if="memberStore.userInfo">
      <view @tap="onLogout" class="button">退出登录</view>
    </view>
  </view>
</template>

<style lang="scss">
@import '@/styles/variables.scss';
page {
  background-color: #f4f4f4;
}

.viewport {
  padding: 20rpx;
}

/* 列表 */
.list {
  background-color: #fff;
  margin-bottom: 20rpx;
  border-radius: 10rpx;
  .item {
    background-color: #fff;
    height: 90rpx;
    line-height: 90rpx;
    padding: 0 20rpx;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    font-size: 32rpx;
    color: $good-font-title-color;
  }
}

/* 操作按钮 */
.action {
  text-align: center;
  line-height: 90rpx;
  margin-top: 40rpx;
  font-size: 32rpx;
  color: #333;
  .button {
    background-color: #fff;
    margin-bottom: 20rpx;
    border-radius: 10rpx;
  }
}
</style>
